package com.dyh.quickdemozwei.futureopreate;

import java.util.concurrent.LinkedBlockingQueue;

public class BootStrap {
//    int masterNum;
    int wokerNum;
    int groupWatchingNum;
    int queueNum;

    public BootStrap() {
    }

//    public BootStrap masterNum(int masterNum){
//        this.masterNum = masterNum;
//        return this;
//    }

    public BootStrap groupWatchingNum(int num){
        this.groupWatchingNum = num;
        return this;
    }

    public BootStrap wokerNum(int wokerNum){
        this.wokerNum = wokerNum;
        return this;
    }

    public BootStrap queueNum(int queueNum){
        this.queueNum = queueNum;
        return this;
    }

    DefaultOperateInspector build(){
        DefaultOperateInspector inspector = new DefaultOperateInspector();
        inspector.setQueue(new LinkedBlockingQueue<>(queueNum));
        inspector.setWorkerThreads(new AbstractOperateInspector.WorkerThread[wokerNum]);
        inspector.setWatchingGroups(new LinkedBlockingQueue<>(groupWatchingNum));

        return inspector;
    }
}
